﻿//==========================================================
// 此代码由TilverNET代码生成工具自动生成，请不要修改
// 代码生成器版本号：1.2
// 作者：landy
// 联系方式：(QQ)86566178
// 创建时间：2014-10-13 11:00:48
//==========================================================

using System;
using System.Text;
using System.Data;
using System.Data.Common;
using System.Collections.Generic;
using System.Linq;
using Tilver.Data;
using Tilver.Data.DataPager;

namespace Weather.DAL.CoWeather
{
	#region EO

	/// <summary>
	///  《dbo.Fcst_Sign_Local(实体类)》
	/// </summary>
	[Serializable]
	public class FcstSignLocalEO : IRowMapper<FcstSignLocalEO>
	{
		protected long _id;
		protected int _date;
		protected string _time;
		protected string _stationnum;
		protected string _signType;
		protected string _signClass;
		protected string _signOperate;
		protected string _signTitle;
		protected string _signText;
		protected byte[] _signWord;
		protected bool? _signRemove;
		protected DateTime? _timeAutoremove;
		protected DateTime _renewTime;


		/// <summary>
		///  《[字段]  [bigint]   自增字段》
		/// </summary>
		public long Id
		{
			get { return _id; }
			set { _id = value;}
		}

		/// <summary>
		///  《[字段]  [int]》
		/// </summary>
		public int Date
		{
			get { return _date; }
			set { _date = value;}
		}

		/// <summary>
		///  《[字段]  [nchar]》
		/// </summary>
		public string Time
		{
			get { return _time; }
			set { _time = value;}
		}

		/// <summary>
		///  《[字段]  [varchar]》
		/// </summary>
		public string Stationnum
		{
			get { return _stationnum; }
			set { _stationnum = value;}
		}

		/// <summary>
		///  《[字段]  [varchar]》
		/// </summary>
		public string SignType
		{
			get { return _signType; }
			set { _signType = value;}
		}

		/// <summary>
		///  《[字段]  [varchar]》
		/// </summary>
		public string SignClass
		{
			get { return _signClass; }
			set { _signClass = value;}
		}

		/// <summary>
		///  《[字段]  [varchar]》
		/// </summary>
		public string SignOperate
		{
			get { return _signOperate; }
			set { _signOperate = value;}
		}

		/// <summary>
		///  《[字段]  [varchar]》
		/// </summary>
		public string SignTitle
		{
			get { return _signTitle; }
			set { _signTitle = value;}
		}

		/// <summary>
		///  《[字段]  [ntext]》
		/// </summary>
		public string SignText
		{
			get { return _signText; }
			set { _signText = value;}
		}

		/// <summary>
		///  《[字段]  [image]》
		/// </summary>
		public byte[] SignWord
		{
			get { return _signWord; }
			set { _signWord = value;}
		}

		/// <summary>
		///  《[字段]  [bit]》
		/// </summary>
		public bool? SignRemove
		{
			get { return _signRemove; }
			set { _signRemove = value;}
		}

		/// <summary>
		///  《[字段]  [datetime]》
		/// </summary>
		public DateTime? TimeAutoremove
		{
			get { return _timeAutoremove; }
			set { _timeAutoremove = value;}
		}

		/// <summary>
		///  《[字段]  [datetime]》
		/// </summary>
		public DateTime RenewTime
		{
			get { return _renewTime; }
			set { _renewTime = value;}
		}

		/// <summary>
		/// 默认构造函数
		/// </summary>
		public FcstSignLocalEO() 
		{
			Time = string.Empty;
			Stationnum = string.Empty;
			SignType = string.Empty;
			SignClass = string.Empty;
			SignOperate = string.Empty;
		}

		/// <summary>
		/// 自定义构造函数
		/// </summary>
		/// <param name = "id"></param>
		/// <param name = "date"></param>
		/// <param name = "time"></param>
		/// <param name = "stationnum"></param>
		/// <param name = "signType"></param>
		/// <param name = "signClass"></param>
		/// <param name = "signOperate"></param>
		/// <param name = "signTitle"></param>
		/// <param name = "signText"></param>
		/// <param name = "signWord"></param>
		/// <param name = "signRemove"></param>
		/// <param name = "timeAutoremove"></param>
		/// <param name = "renewTime"></param>
		public FcstSignLocalEO(long id, int date, string time, string stationnum, string signType, string signClass, string signOperate, string signTitle, string signText, byte[] signWord, bool? signRemove, DateTime? timeAutoremove, DateTime renewTime) 
		{
			_id = id;
			_date = date;
			_time = time;
			_stationnum = stationnum;
			_signType = signType;
			_signClass = signClass;
			_signOperate = signOperate;
			_signTitle = signTitle;
			_signText = signText;
			_signWord = signWord;
			_signRemove = signRemove;
			_timeAutoremove = timeAutoremove;
			_renewTime = renewTime;
		}


		/// <summary>
		/// 将结果集映射成实体对象
		/// </summary>
		/// <param name = "reader">只进结果集流</param>
		/// <return></return>
		public FcstSignLocalEO MapRow(IDataReader reader)
		{
			var ret = new FcstSignLocalEO();
			ret.Id = (long)reader["id"];
			ret.Date = (int)reader["date"];
			ret.Time = (string)reader["time"];
			ret.Stationnum = (string)reader["stationnum"];
			ret.SignType = (string)reader["sign_type"];
			ret.SignClass = (string)reader["sign_class"];
			ret.SignOperate = (string)reader["sign_operate"];
			ret.SignTitle = (reader["sign_title"] is DBNull) ? null : (string)reader["sign_title"];
			ret.SignText = (reader["sign_text"] is DBNull) ? null : (string)reader["sign_text"];
			ret.SignWord = (reader["sign_word"] is DBNull) ? null : (byte[])reader["sign_word"];
			ret.SignRemove = (reader["sign_remove"] is DBNull) ? null : (bool?)reader["sign_remove"];
			ret.TimeAutoremove = (reader["time_autoremove"] is DBNull) ? null : (DateTime?)reader["time_autoremove"];
			ret.RenewTime = (DateTime)reader["renewTime"];
			return ret;
		}

		/// <summary>
		/// 将结果集映射成实体对象，返回映射方法
		/// </summary>
		/// <return></return>
		public Func<IDataReader, FcstSignLocalEO> GetMapper()
		{
			return MapRow;
		}


	}


	#endregion
	#region MO

	/// <summary>
	///  《dbo.Fcst_Sign_Local(逻辑类)》
	/// </summary>
	public class FcstSignLocalMO : DbManagerBase
	{

		#region 构造函数
		/// <summary>
		/// 构造函数
		/// </summary>
		/// <param name = "routeData">路由数据</param>
		public FcstSignLocalMO(object routeData = null) : base(routeData) { }

		/// <summary>
		/// 构造函数
		/// </summary>
		/// <param name = "connectionStringName">连接字符串名称</param>
		public FcstSignLocalMO(string connectionStringName) : base(connectionStringName) { }

		#endregion

		#region 私有方法
		/// <summary>
		/// 数据库访问操作方法
		/// </summary>
		/// <param name = "sql">SQL语句</param>
		/// <return>返回数据操作对象</return>
		private DbAdoBase AdoBase(string sql)
		{
			return DataBase.CreateDbAdo(sql, CommandType.Text);
		}

		#endregion

		#region Select方法集合

		/// <summary>
		/// 按字段查询
		/// </summary>
		/// <param name = "id"></param>
		/// <param name = "top">获取记录数，当top值小于或等于0时忽略top条件</param>
		/// <param name = "sort">排序表达式，如：field1 ASC,field2 DESC</param>
		/// <param name="tm">事务管理对象</param>
		/// <return></return>
		public List<FcstSignLocalEO> SelectById(long id, int top, string sort, TransactionManager tm = null)
		{
			var sql = new StringBuilder();
			var format = new StringBuilder();
			format.Append(@"SELECT {0} [id], [date], [time], [stationnum], [sign_type], [sign_class], [sign_operate], [sign_title], [sign_text], [sign_word], [sign_remove], [time_autoremove], [renewTime] FROM [dbo].[Fcst_Sign_Local] WHERE [id]=@Id");
			if (!string.IsNullOrEmpty(sort)) format.AppendFormat(" ORDER BY {0} ", sort);
			sql.AppendFormat(format.ToString(), (top > 0) ? string.Format("TOP {0}", top) : string.Empty);
			return AdoBase(sql.ToString())
							.AddInParameter("@Id", id, DbType.Int64, 8)
							.ExecuteList(new FcstSignLocalEO().GetMapper(), tm);
		}
		/// <summary>
		/// 按字段查询
		/// </summary>
		/// <param name = "date"></param>
		/// <param name = "top">获取记录数，当top值小于或等于0时忽略top条件</param>
		/// <param name = "sort">排序表达式，如：field1 ASC,field2 DESC</param>
		/// <param name="tm">事务管理对象</param>
		/// <return></return>
		public List<FcstSignLocalEO> SelectByDate(int date, int top, string sort, TransactionManager tm = null)
		{
			var sql = new StringBuilder();
			var format = new StringBuilder();
			format.Append(@"SELECT {0} [id], [date], [time], [stationnum], [sign_type], [sign_class], [sign_operate], [sign_title], [sign_text], [sign_word], [sign_remove], [time_autoremove], [renewTime] FROM [dbo].[Fcst_Sign_Local] WHERE [date]=@Date");
			if (!string.IsNullOrEmpty(sort)) format.AppendFormat(" ORDER BY {0} ", sort);
			sql.AppendFormat(format.ToString(), (top > 0) ? string.Format("TOP {0}", top) : string.Empty);
			return AdoBase(sql.ToString())
							.AddInParameter("@Date", date, DbType.Int32, 4)
							.ExecuteList(new FcstSignLocalEO().GetMapper(), tm);
		}
		/// <summary>
		/// 按字段查询
		/// </summary>
		/// <param name = "time"></param>
		/// <param name = "top">获取记录数，当top值小于或等于0时忽略top条件</param>
		/// <param name = "sort">排序表达式，如：field1 ASC,field2 DESC</param>
		/// <param name="tm">事务管理对象</param>
		/// <return></return>
		public List<FcstSignLocalEO> SelectByTime(string time, int top, string sort, TransactionManager tm = null)
		{
			var sql = new StringBuilder();
			var format = new StringBuilder();
			format.Append(@"SELECT {0} [id], [date], [time], [stationnum], [sign_type], [sign_class], [sign_operate], [sign_title], [sign_text], [sign_word], [sign_remove], [time_autoremove], [renewTime] FROM [dbo].[Fcst_Sign_Local] WHERE [time]=@Time");
			if (!string.IsNullOrEmpty(sort)) format.AppendFormat(" ORDER BY {0} ", sort);
			sql.AppendFormat(format.ToString(), (top > 0) ? string.Format("TOP {0}", top) : string.Empty);
			return AdoBase(sql.ToString())
							.AddInParameter("@Time", time, DbType.StringFixedLength, 4)
							.ExecuteList(new FcstSignLocalEO().GetMapper(), tm);
		}
		/// <summary>
		/// 按字段查询
		/// </summary>
		/// <param name = "stationnum"></param>
		/// <param name = "top">获取记录数，当top值小于或等于0时忽略top条件</param>
		/// <param name = "sort">排序表达式，如：field1 ASC,field2 DESC</param>
		/// <param name="tm">事务管理对象</param>
		/// <return></return>
		public List<FcstSignLocalEO> SelectByStationnum(string stationnum, int top, string sort, TransactionManager tm = null)
		{
			var sql = new StringBuilder();
			var format = new StringBuilder();
			format.Append(@"SELECT {0} [id], [date], [time], [stationnum], [sign_type], [sign_class], [sign_operate], [sign_title], [sign_text], [sign_word], [sign_remove], [time_autoremove], [renewTime] FROM [dbo].[Fcst_Sign_Local] WHERE [stationnum]=@Stationnum");
			if (!string.IsNullOrEmpty(sort)) format.AppendFormat(" ORDER BY {0} ", sort);
			sql.AppendFormat(format.ToString(), (top > 0) ? string.Format("TOP {0}", top) : string.Empty);
			return AdoBase(sql.ToString())
							.AddInParameter("@Stationnum", stationnum, DbType.AnsiString, 16)
							.ExecuteList(new FcstSignLocalEO().GetMapper(), tm);
		}
		/// <summary>
		/// 按字段查询
		/// </summary>
		/// <param name = "signType"></param>
		/// <param name = "top">获取记录数，当top值小于或等于0时忽略top条件</param>
		/// <param name = "sort">排序表达式，如：field1 ASC,field2 DESC</param>
		/// <param name="tm">事务管理对象</param>
		/// <return></return>
		public List<FcstSignLocalEO> SelectBySignType(string signType, int top, string sort, TransactionManager tm = null)
		{
			var sql = new StringBuilder();
			var format = new StringBuilder();
			format.Append(@"SELECT {0} [id], [date], [time], [stationnum], [sign_type], [sign_class], [sign_operate], [sign_title], [sign_text], [sign_word], [sign_remove], [time_autoremove], [renewTime] FROM [dbo].[Fcst_Sign_Local] WHERE [sign_type]=@SignType");
			if (!string.IsNullOrEmpty(sort)) format.AppendFormat(" ORDER BY {0} ", sort);
			sql.AppendFormat(format.ToString(), (top > 0) ? string.Format("TOP {0}", top) : string.Empty);
			return AdoBase(sql.ToString())
							.AddInParameter("@SignType", signType, DbType.AnsiString, 10)
							.ExecuteList(new FcstSignLocalEO().GetMapper(), tm);
		}
		/// <summary>
		/// 按字段查询
		/// </summary>
		/// <param name = "signClass"></param>
		/// <param name = "top">获取记录数，当top值小于或等于0时忽略top条件</param>
		/// <param name = "sort">排序表达式，如：field1 ASC,field2 DESC</param>
		/// <param name="tm">事务管理对象</param>
		/// <return></return>
		public List<FcstSignLocalEO> SelectBySignClass(string signClass, int top, string sort, TransactionManager tm = null)
		{
			var sql = new StringBuilder();
			var format = new StringBuilder();
			format.Append(@"SELECT {0} [id], [date], [time], [stationnum], [sign_type], [sign_class], [sign_operate], [sign_title], [sign_text], [sign_word], [sign_remove], [time_autoremove], [renewTime] FROM [dbo].[Fcst_Sign_Local] WHERE [sign_class]=@SignClass");
			if (!string.IsNullOrEmpty(sort)) format.AppendFormat(" ORDER BY {0} ", sort);
			sql.AppendFormat(format.ToString(), (top > 0) ? string.Format("TOP {0}", top) : string.Empty);
			return AdoBase(sql.ToString())
							.AddInParameter("@SignClass", signClass, DbType.AnsiString, 10)
							.ExecuteList(new FcstSignLocalEO().GetMapper(), tm);
		}
		/// <summary>
		/// 按字段查询
		/// </summary>
		/// <param name = "signOperate"></param>
		/// <param name = "top">获取记录数，当top值小于或等于0时忽略top条件</param>
		/// <param name = "sort">排序表达式，如：field1 ASC,field2 DESC</param>
		/// <param name="tm">事务管理对象</param>
		/// <return></return>
		public List<FcstSignLocalEO> SelectBySignOperate(string signOperate, int top, string sort, TransactionManager tm = null)
		{
			var sql = new StringBuilder();
			var format = new StringBuilder();
			format.Append(@"SELECT {0} [id], [date], [time], [stationnum], [sign_type], [sign_class], [sign_operate], [sign_title], [sign_text], [sign_word], [sign_remove], [time_autoremove], [renewTime] FROM [dbo].[Fcst_Sign_Local] WHERE [sign_operate]=@SignOperate");
			if (!string.IsNullOrEmpty(sort)) format.AppendFormat(" ORDER BY {0} ", sort);
			sql.AppendFormat(format.ToString(), (top > 0) ? string.Format("TOP {0}", top) : string.Empty);
			return AdoBase(sql.ToString())
							.AddInParameter("@SignOperate", signOperate, DbType.AnsiString, 10)
							.ExecuteList(new FcstSignLocalEO().GetMapper(), tm);
		}
		/// <summary>
		/// 按字段查询
		/// </summary>
		/// <param name = "signTitle"></param>
		/// <param name = "top">获取记录数，当top值小于或等于0时忽略top条件</param>
		/// <param name = "sort">排序表达式，如：field1 ASC,field2 DESC</param>
		/// <param name="tm">事务管理对象</param>
		/// <return></return>
		public List<FcstSignLocalEO> SelectBySignTitle(string signTitle, int top, string sort, TransactionManager tm = null)
		{
			var sql = new StringBuilder();
			var format = new StringBuilder();
			format.Append(@"SELECT {0} [id], [date], [time], [stationnum], [sign_type], [sign_class], [sign_operate], [sign_title], [sign_text], [sign_word], [sign_remove], [time_autoremove], [renewTime] FROM [dbo].[Fcst_Sign_Local] WHERE [sign_title]=@SignTitle");
			if (!string.IsNullOrEmpty(sort)) format.AppendFormat(" ORDER BY {0} ", sort);
			sql.AppendFormat(format.ToString(), (top > 0) ? string.Format("TOP {0}", top) : string.Empty);
			return AdoBase(sql.ToString())
							.AddInParameter("@SignTitle", signTitle, DbType.AnsiString, 256)
							.ExecuteList(new FcstSignLocalEO().GetMapper(), tm);
		}
		/// <summary>
		/// 按字段查询
		/// </summary>
		/// <param name = "signText"></param>
		/// <param name = "top">获取记录数，当top值小于或等于0时忽略top条件</param>
		/// <param name = "sort">排序表达式，如：field1 ASC,field2 DESC</param>
		/// <param name="tm">事务管理对象</param>
		/// <return></return>
		public List<FcstSignLocalEO> SelectBySignText(string signText, int top, string sort, TransactionManager tm = null)
		{
			var sql = new StringBuilder();
			var format = new StringBuilder();
			format.Append(@"SELECT {0} [id], [date], [time], [stationnum], [sign_type], [sign_class], [sign_operate], [sign_title], [sign_text], [sign_word], [sign_remove], [time_autoremove], [renewTime] FROM [dbo].[Fcst_Sign_Local] WHERE [sign_text]=@SignText");
			if (!string.IsNullOrEmpty(sort)) format.AppendFormat(" ORDER BY {0} ", sort);
			sql.AppendFormat(format.ToString(), (top > 0) ? string.Format("TOP {0}", top) : string.Empty);
			return AdoBase(sql.ToString())
							.AddInParameter("@SignText", signText, DbType.String, 16)
							.ExecuteList(new FcstSignLocalEO().GetMapper(), tm);
		}
		/// <summary>
		/// 按字段查询
		/// </summary>
		/// <param name = "signWord"></param>
		/// <param name = "top">获取记录数，当top值小于或等于0时忽略top条件</param>
		/// <param name = "sort">排序表达式，如：field1 ASC,field2 DESC</param>
		/// <param name="tm">事务管理对象</param>
		/// <return></return>
		public List<FcstSignLocalEO> SelectBySignWord(byte[] signWord, int top, string sort, TransactionManager tm = null)
		{
			var sql = new StringBuilder();
			var format = new StringBuilder();
			format.Append(@"SELECT {0} [id], [date], [time], [stationnum], [sign_type], [sign_class], [sign_operate], [sign_title], [sign_text], [sign_word], [sign_remove], [time_autoremove], [renewTime] FROM [dbo].[Fcst_Sign_Local] WHERE [sign_word]=@SignWord");
			if (!string.IsNullOrEmpty(sort)) format.AppendFormat(" ORDER BY {0} ", sort);
			sql.AppendFormat(format.ToString(), (top > 0) ? string.Format("TOP {0}", top) : string.Empty);
			return AdoBase(sql.ToString())
							.AddInParameter("@SignWord", signWord, DbType.Binary, 16)
							.ExecuteList(new FcstSignLocalEO().GetMapper(), tm);
		}
		/// <summary>
		/// 按字段查询
		/// </summary>
		/// <param name = "signRemove"></param>
		/// <param name = "top">获取记录数，当top值小于或等于0时忽略top条件</param>
		/// <param name = "sort">排序表达式，如：field1 ASC,field2 DESC</param>
		/// <param name="tm">事务管理对象</param>
		/// <return></return>
		public List<FcstSignLocalEO> SelectBySignRemove(bool? signRemove, int top, string sort, TransactionManager tm = null)
		{
			var sql = new StringBuilder();
			var format = new StringBuilder();
			format.Append(@"SELECT {0} [id], [date], [time], [stationnum], [sign_type], [sign_class], [sign_operate], [sign_title], [sign_text], [sign_word], [sign_remove], [time_autoremove], [renewTime] FROM [dbo].[Fcst_Sign_Local] WHERE [sign_remove]=@SignRemove");
			if (!string.IsNullOrEmpty(sort)) format.AppendFormat(" ORDER BY {0} ", sort);
			sql.AppendFormat(format.ToString(), (top > 0) ? string.Format("TOP {0}", top) : string.Empty);
			return AdoBase(sql.ToString())
							.AddInParameter("@SignRemove", signRemove, DbType.Boolean, 1)
							.ExecuteList(new FcstSignLocalEO().GetMapper(), tm);
		}
		/// <summary>
		/// 按字段查询
		/// </summary>
		/// <param name = "timeAutoremove"></param>
		/// <param name = "top">获取记录数，当top值小于或等于0时忽略top条件</param>
		/// <param name = "sort">排序表达式，如：field1 ASC,field2 DESC</param>
		/// <param name="tm">事务管理对象</param>
		/// <return></return>
		public List<FcstSignLocalEO> SelectByTimeAutoremove(DateTime? timeAutoremove, int top, string sort, TransactionManager tm = null)
		{
			var sql = new StringBuilder();
			var format = new StringBuilder();
			format.Append(@"SELECT {0} [id], [date], [time], [stationnum], [sign_type], [sign_class], [sign_operate], [sign_title], [sign_text], [sign_word], [sign_remove], [time_autoremove], [renewTime] FROM [dbo].[Fcst_Sign_Local] WHERE [time_autoremove]=@TimeAutoremove");
			if (!string.IsNullOrEmpty(sort)) format.AppendFormat(" ORDER BY {0} ", sort);
			sql.AppendFormat(format.ToString(), (top > 0) ? string.Format("TOP {0}", top) : string.Empty);
			return AdoBase(sql.ToString())
							.AddInParameter("@TimeAutoremove", timeAutoremove, DbType.DateTime, 8)
							.ExecuteList(new FcstSignLocalEO().GetMapper(), tm);
		}
		/// <summary>
		/// 按字段查询
		/// </summary>
		/// <param name = "renewTime"></param>
		/// <param name = "top">获取记录数，当top值小于或等于0时忽略top条件</param>
		/// <param name = "sort">排序表达式，如：field1 ASC,field2 DESC</param>
		/// <param name="tm">事务管理对象</param>
		/// <return></return>
		public List<FcstSignLocalEO> SelectByRenewTime(DateTime renewTime, int top, string sort, TransactionManager tm = null)
		{
			var sql = new StringBuilder();
			var format = new StringBuilder();
			format.Append(@"SELECT {0} [id], [date], [time], [stationnum], [sign_type], [sign_class], [sign_operate], [sign_title], [sign_text], [sign_word], [sign_remove], [time_autoremove], [renewTime] FROM [dbo].[Fcst_Sign_Local] WHERE [renewTime]=@RenewTime");
			if (!string.IsNullOrEmpty(sort)) format.AppendFormat(" ORDER BY {0} ", sort);
			sql.AppendFormat(format.ToString(), (top > 0) ? string.Format("TOP {0}", top) : string.Empty);
			return AdoBase(sql.ToString())
							.AddInParameter("@RenewTime", renewTime, DbType.DateTime, 8)
							.ExecuteList(new FcstSignLocalEO().GetMapper(), tm);
		}

		/// <summary>
		/// 按自定义条件查询
		/// </summary>
		/// <param name = "where">自定义条件,where子句</param>
		/// <param name = "top">获取行数</param>
		/// <param name = "sort">排序表达式</param>
		/// <param name = "paras">where子句中定义的参数集合</param>
		/// <param name="tm">事务管理对象</param>
		/// <return></return>
		public List<FcstSignLocalEO> Select(string where, int top, string sort, IEnumerable<DbParameter> paras, TransactionManager tm = null)
		{
			var sql = new StringBuilder();
			var format = new StringBuilder();
			format.Append(@"SELECT {0} [id], [date], [time], [stationnum], [sign_type], [sign_class], [sign_operate], [sign_title], [sign_text], [sign_word], [sign_remove], [time_autoremove], [renewTime] FROM [dbo].[Fcst_Sign_Local] ");
			if (!string.IsNullOrEmpty(where)) format.AppendFormat(" WHERE {0} ", where);
			if (!string.IsNullOrEmpty(sort)) format.AppendFormat(" ORDER BY {0} ", sort);
			sql.AppendFormat(format.ToString(), (top > 0) ? string.Format("TOP {0}", top) : string.Empty);
			return AdoBase(sql.ToString())
							.AddParameters(paras)
							.ExecuteList(new FcstSignLocalEO().GetMapper(), tm);
		}

		/// <summary>
		/// 分页查询
		/// </summary>
		/// <param name = "where">条件表达式</param>
		/// <param name = "sort">排序表达式</param>
		/// <param name = "paras">传入参数</param>
		/// <param name = "pageSize">页大小</param>
		/// <param name = "pageIndex">页码</param>
		/// <param name = "recordCount">总记录数，由于计算总记录数影响数据库性能，只有小于或等于0的情况下才返回总记录数</param>
		/// <return>分页数据</return>
		public List<FcstSignLocalEO> SelectPager(string where, string sort, IList<DbParameter> paras, long pageSize, long pageIndex, ref long recordCount)
		{
			var sql = new StringBuilder();
			sql.AppendFormat(@"SELECT [id], [date], [time], [stationnum], [sign_type], [sign_class], [sign_operate], [sign_title], [sign_text], [sign_word], [sign_remove], [time_autoremove], [renewTime] FROM [dbo].[Fcst_Sign_Local]");
			if (!string.IsNullOrEmpty(where)) sql.AppendFormat(" WHERE {0} ", where);
			if (!string.IsNullOrEmpty(sort)) sql.AppendFormat(" ORDER BY {0} ", sort);
			var pager = this.DataBase.CreatePager(sql.ToString(), pageSize);
			pager.AddParameters(paras);
			if (recordCount <= 0)
			{
				recordCount = pager.GetRecordCount();
			}
			return pager.GetPageData(pageIndex).MapToList(new FcstSignLocalEO().GetMapper());
		}

		#endregion

		#region Insert方法集合
		/// <summary>
		/// 插入数据，有自增列时，item中自增字段为新增值，否则，返回影响的行数
		/// </summary>
		/// <param name="tm">事务管理对象</param>
		/// <param name = "item">要插入的实体对象</param>
		/// <return></return>
		public int Insert(FcstSignLocalEO item, TransactionManager tm = null)
		{
			const string sql = @"INSERT INTO [dbo].[Fcst_Sign_Local] ([date], [time], [stationnum], [sign_type], [sign_class], [sign_operate], [sign_title], [sign_text], [sign_word], [sign_remove], [time_autoremove], [renewTime]) VALUES (@date, @time, @stationnum, @sign_type, @sign_class, @sign_operate, @sign_title, @sign_text, @sign_word, @sign_remove, @time_autoremove, @renewTime) ;SELECT SCOPE_IDENTITY();";
			item.Id = long.Parse(AdoBase(sql)
												.AddInParameter("@date", item.Date, DbType.Int32, 4)
												.AddInParameter("@time", item.Time, DbType.StringFixedLength, 4)
												.AddInParameter("@stationnum", item.Stationnum, DbType.AnsiString, 16)
												.AddInParameter("@sign_type", item.SignType, DbType.AnsiString, 10)
												.AddInParameter("@sign_class", item.SignClass, DbType.AnsiString, 10)
												.AddInParameter("@sign_operate", item.SignOperate, DbType.AnsiString, 10)
												.AddInParameter("@sign_title", item.SignTitle != null ?  (object)item.SignTitle : DBNull.Value, DbType.AnsiString, 256)
												.AddInParameter("@sign_text", item.SignText != null ?  (object)item.SignText : DBNull.Value, DbType.String, -1)
												.AddInParameter("@sign_word", item.SignWord != null ?  (object)item.SignWord : DBNull.Value, DbType.Binary, 16)
												.AddInParameter("@sign_remove", item.SignRemove.HasValue ? (object)item.SignRemove.Value : DBNull.Value, DbType.Boolean, 1)
												.AddInParameter("@time_autoremove", item.TimeAutoremove.HasValue ? (object)item.TimeAutoremove.Value : DBNull.Value, DbType.DateTime, 8)
												.AddInParameter("@renewTime", item.RenewTime, DbType.DateTime, 8)
												.ExecuteScalar(tm).ToString());
			return 1;
		}
		#endregion

		#region Update方法集合
		/// <summary>
		/// 按自定义条件更新数据
		/// </summary>
		/// <param name = "set">更新列</param>
		/// <param name = "where">更新条件</param>
		/// <param name = "paras">参数集合</param>
		/// <param name="tm">事务管理对象</param>
		/// <return></return>
		public int Update(string set, string where, IEnumerable<DbParameter> paras, TransactionManager tm = null)
		{
			if (string.IsNullOrEmpty(set)) throw new ArgumentNullException("set");
			var sql = string.Format(@"UPDATE [dbo].[Fcst_Sign_Local] SET {0} {1}", set, (string.IsNullOrEmpty(where) ? string.Empty : " WHERE " + where));
			return AdoBase(sql)
							.AddParameters(paras)
							.ExecuteNonQuery(tm);
		}
		#endregion

		#region Delete方法集合
		/// <summary>
		/// 按字段删除
		/// </summary>
		/// <param name="tm">事务管理对象</param>
		/// <param name = "id"></param>
		public int DeleteById(long id, TransactionManager tm = null)
		{
			const string sql = @"DELETE FROM [dbo].[Fcst_Sign_Local] WHERE [id]=@id";
			return AdoBase(sql)
							.AddInParameter("@id", id, DbType.Int64, 8)
							.ExecuteNonQuery(tm);
		}
		/// <summary>
		/// 按字段删除
		/// </summary>
		/// <param name="tm">事务管理对象</param>
		/// <param name = "date"></param>
		public int DeleteByDate(int date, TransactionManager tm = null)
		{
			const string sql = @"DELETE FROM [dbo].[Fcst_Sign_Local] WHERE [date]=@date";
			return AdoBase(sql)
							.AddInParameter("@date", date, DbType.Int32, 4)
							.ExecuteNonQuery(tm);
		}
		/// <summary>
		/// 按字段删除
		/// </summary>
		/// <param name="tm">事务管理对象</param>
		/// <param name = "time"></param>
		public int DeleteByTime(string time, TransactionManager tm = null)
		{
			const string sql = @"DELETE FROM [dbo].[Fcst_Sign_Local] WHERE [time]=@time";
			return AdoBase(sql)
							.AddInParameter("@time", time, DbType.StringFixedLength, 4)
							.ExecuteNonQuery(tm);
		}
		/// <summary>
		/// 按字段删除
		/// </summary>
		/// <param name="tm">事务管理对象</param>
		/// <param name = "stationnum"></param>
		public int DeleteByStationnum(string stationnum, TransactionManager tm = null)
		{
			const string sql = @"DELETE FROM [dbo].[Fcst_Sign_Local] WHERE [stationnum]=@stationnum";
			return AdoBase(sql)
							.AddInParameter("@stationnum", stationnum, DbType.AnsiString, 16)
							.ExecuteNonQuery(tm);
		}
		/// <summary>
		/// 按字段删除
		/// </summary>
		/// <param name="tm">事务管理对象</param>
		/// <param name = "signType"></param>
		public int DeleteBySignType(string signType, TransactionManager tm = null)
		{
			const string sql = @"DELETE FROM [dbo].[Fcst_Sign_Local] WHERE [sign_type]=@sign_type";
			return AdoBase(sql)
							.AddInParameter("@sign_type", signType, DbType.AnsiString, 10)
							.ExecuteNonQuery(tm);
		}
		/// <summary>
		/// 按字段删除
		/// </summary>
		/// <param name="tm">事务管理对象</param>
		/// <param name = "signClass"></param>
		public int DeleteBySignClass(string signClass, TransactionManager tm = null)
		{
			const string sql = @"DELETE FROM [dbo].[Fcst_Sign_Local] WHERE [sign_class]=@sign_class";
			return AdoBase(sql)
							.AddInParameter("@sign_class", signClass, DbType.AnsiString, 10)
							.ExecuteNonQuery(tm);
		}
		/// <summary>
		/// 按字段删除
		/// </summary>
		/// <param name="tm">事务管理对象</param>
		/// <param name = "signOperate"></param>
		public int DeleteBySignOperate(string signOperate, TransactionManager tm = null)
		{
			const string sql = @"DELETE FROM [dbo].[Fcst_Sign_Local] WHERE [sign_operate]=@sign_operate";
			return AdoBase(sql)
							.AddInParameter("@sign_operate", signOperate, DbType.AnsiString, 10)
							.ExecuteNonQuery(tm);
		}
		/// <summary>
		/// 按字段删除
		/// </summary>
		/// <param name="tm">事务管理对象</param>
		/// <param name = "signTitle"></param>
		public int DeleteBySignTitle(string signTitle, TransactionManager tm = null)
		{
			const string sql = @"DELETE FROM [dbo].[Fcst_Sign_Local] WHERE [sign_title]=@sign_title";
			return AdoBase(sql)
							.AddInParameter("@sign_title", signTitle != null ?  (object)signTitle : DBNull.Value, DbType.AnsiString, 256)
							.ExecuteNonQuery(tm);
		}
		/// <summary>
		/// 按字段删除
		/// </summary>
		/// <param name="tm">事务管理对象</param>
		/// <param name = "signText"></param>
		public int DeleteBySignText(string signText, TransactionManager tm = null)
		{
			const string sql = @"DELETE FROM [dbo].[Fcst_Sign_Local] WHERE [sign_text]=@sign_text";
			return AdoBase(sql)
							.AddInParameter("@sign_text", signText != null ?  (object)signText : DBNull.Value, DbType.String, -1)
							.ExecuteNonQuery(tm);
		}
		/// <summary>
		/// 按字段删除
		/// </summary>
		/// <param name="tm">事务管理对象</param>
		/// <param name = "signWord"></param>
		public int DeleteBySignWord(byte[] signWord, TransactionManager tm = null)
		{
			const string sql = @"DELETE FROM [dbo].[Fcst_Sign_Local] WHERE [sign_word]=@sign_word";
			return AdoBase(sql)
							.AddInParameter("@sign_word", signWord != null ?  (object)signWord : DBNull.Value, DbType.Binary, 16)
							.ExecuteNonQuery(tm);
		}
		/// <summary>
		/// 按字段删除
		/// </summary>
		/// <param name="tm">事务管理对象</param>
		/// <param name = "signRemove"></param>
		public int DeleteBySignRemove(bool? signRemove, TransactionManager tm = null)
		{
			const string sql = @"DELETE FROM [dbo].[Fcst_Sign_Local] WHERE [sign_remove]=@sign_remove";
			return AdoBase(sql)
							.AddInParameter("@sign_remove", signRemove.HasValue ? (object)signRemove.Value : DBNull.Value, DbType.Boolean, 1)
							.ExecuteNonQuery(tm);
		}
		/// <summary>
		/// 按字段删除
		/// </summary>
		/// <param name="tm">事务管理对象</param>
		/// <param name = "timeAutoremove"></param>
		public int DeleteByTimeAutoremove(DateTime? timeAutoremove, TransactionManager tm = null)
		{
			const string sql = @"DELETE FROM [dbo].[Fcst_Sign_Local] WHERE [time_autoremove]=@time_autoremove";
			return AdoBase(sql)
							.AddInParameter("@time_autoremove", timeAutoremove.HasValue ? (object)timeAutoremove.Value : DBNull.Value, DbType.DateTime, 8)
							.ExecuteNonQuery(tm);
		}
		/// <summary>
		/// 按字段删除
		/// </summary>
		/// <param name="tm">事务管理对象</param>
		/// <param name = "renewTime"></param>
		public int DeleteByRenewTime(DateTime renewTime, TransactionManager tm = null)
		{
			const string sql = @"DELETE FROM [dbo].[Fcst_Sign_Local] WHERE [renewTime]=@renewTime";
			return AdoBase(sql)
							.AddInParameter("@renewTime", renewTime, DbType.DateTime, 8)
							.ExecuteNonQuery(tm);
		}
		/// <summary>
		/// 删除指定条件的记录
		/// </summary>
		/// <param name = "whereClause">自定义删除条件，where子句。如：id=1 and name='aaa'</param>
		/// <param name = "paras">where子句中定义的参数集合</param>
		/// <param name="tm">事务管理对象</param>
		/// <return></return>
		public int Delete(string whereClause, IEnumerable<DbParameter> paras, TransactionManager tm = null)
		{
			var sql = string.Format(@"DELETE FROM [dbo].[Fcst_Sign_Local] {0}", (string.IsNullOrEmpty(whereClause) ? string.Empty : " WHERE " + whereClause));
			return AdoBase(sql)
							.AddParameters(paras)
							.ExecuteNonQuery(tm);
		}
		#endregion

		#region  自定义方法集合
		#endregion

	}


	#endregion
}
